<{include file="public/header.html"}>
<script src="/static/public/jquery.pagination.js" type="text/javascript" charset="utf-8"></script>
<div class="fossa">
    <{include file="public/user_top.html"}>
    <div class="mwenda w1180-con pb20">
        <div class="fl">
            <div class="mwenda-tab">
                <a href="<{eval url('account')}>" class="mwenda-head">
                    <img src="<{$bbs_user_info['head_img']}>"/>
                </a>
                <ul>
                    <li
                    <{if $act == 'taskrel'}>class="on"<{/if}>>
                    <a href="<{eval url('account/taskrel')}>">
                        我的发布
                        <i></i>
                    </a>
                    </li>
                    <li
                    <{if $act == 'taskrec'}>class="on"<{/if}>>
                    <a href="<{eval url('account/taskrec')}>">
                        我的领取
                        <i></i>
                    </a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="mwenda-con fr">
            <div class="title bjf p20 mt20">
                <ul class="num fl mt15 ml30">
                    <li>
                        <a href="javascript:;" class="best">
                            任务收益
                            <p><{$count['taskrecM_count']}></p>
                            <b class="icon-index"></b>
                        </a>
                    </li>
                    <li>
                        <a href="<{eval url('account/taskrel')}>">
                            发布数
                            <p><{$count['taskrel_count']}></p>
                        </a>
                    </li>
                    <li>
                        <a href="<{eval url('account/taskrec')}>">
                            领取数
                            <p><{$count['taskrec_count']}></p>
                        </a>
                    </li>
                    <li style="border-right: 0;">
                        <a href="<{eval url('account/taskrec')}>">
                            完成数
                            <p><{$count['taskrecend_count']}></p>
                        </a>
                    </li>
                    <div class="clear"></div>
                </ul>
                <{if $act == 'taskrel'}>
                <a href="<{eval url('account/taskrecalllog')}>" class="btn fr mt20 mlr10" style="background: #af6666">所有领取</a>
                <{/if}>
                <a href="<{eval url('task/add')}>" class="btn fr mt20">我要发布</a>
                <div class="clear"></div>
            </div>
            <{if $action == 'taskrel'}>
            <div class="mwenda-list mt30 bjf">
                <div class="p20">
                    <ul class="list-tab" data-cat="taskrel">
                        <li class="on" data-type="0">
                            <a href="javascript:void(0);">所有任务</a>
                        </li>
                        <li data-type="1">
                            <a href="javascript:void(0);">未结束</a>
                        </li>
                        <li data-type="2">
                            <a href="javascript:void(0);">已结束</a>
                        </li>
                        <div class="clear"></div>
                    </ul>
                    <div class="task-list-content">
                        <div class="tl-list">
                            <ul class="task-list-ul taskrel-list-box">
                                <script>$(function () {
                                    load_page_taskrel();
                                });</script>
                            </ul>
                        </div>
                    </div>
                    <div class="clear"></div>
                </div>
                <script>
                    function append_money(tid,liub_balance) {
                        layer.prompt({value: liub_balance,title: '请输入追加金额'}, function(value, index, elem){
                            $.ajax({
                                type: 'POST',
                                url: '/task/add_amount.html',//发送请求
                                data: {tid: tid,amount:value},
                                dataType: "json",
                                success: function (result) {
                                    var icon = result.reqStatus ? 1 : 2;
                                    layer.msg(result.msg, {
                                        icon: icon,
                                        time: 2000
                                    }, function () {
                                        if(result.code==0){
                                            load_page_taskrel();
                                        }else{
                                            location.url=result.link;
                                        }
                                    })
                                }
                            });
                        })
                    }
                    function closetask(tid) {
                        layer.confirm("确认关闭该任务？", {
                            btn: ['确定', '取消'] //按钮
                        }, function () {
                            $.ajax({
                                type: 'POST',
                                url: '/ajax/ajax_closetask.html',//发送请求
                                data: {tid: tid},
                                dataType: "json",
                                success: function (result) {
                                    var icon = result.reqStatus ? 1 : 2;
                                    layer.msg(result.meg, {
                                        icon: icon,
                                        time: 2000
                                    }, function () {
                                        load_page_taskrel();
                                    })
                                }
                            });
                        }, function (ind) {
                            layer.close(ind);
                        });
                    }
                    function pausetask(tid,sta) {
                        layer.confirm("确认暂停该任务领取吗？", {
                            btn: ['确定', '取消'] //按钮
                        }, function () {
                            $.ajax({
                                type: 'POST',
                                url: '/ajax/ajax_task_pause.html',//发送请求
                                data: {tid: tid,status: sta},
                                dataType: "json",
                                success: function (result) {
                                    var icon = result.reqStatus ? 1 : 2;
                                    layer.msg(result.meg, {
                                        icon: icon,
                                        time: 2000
                                    }, function () {
                                        load_page_taskrel();
                                    })
                                }
                            });
                        }, function (ind) {
                            layer.close(ind);
                        });
                    }
                </script>
                <div class="pages fr" id="taskrel_list_pagination">
                    <{$showPage}>
                    <div class="clear"></div>
                </div>
            </div>
            <{/if}>

            <{if $action == 'taskreclog'}>
            <div class="title bjf p10 mt10" style="line-height: 20px;">
                <div class="fl mr10">
                    <a href="/task/<{$task_id}>.html" target="_blank">
                        任务名称：
                        <p style="color: #8f8f94"><{$taskinfo['title']}></p>
                    </a>
                </div>
                <div class="fl ml10">
                    <a href="<{eval url('account/taskrel')}>">
                        发布时间：
                        <p style="color: #8f8f94"><{$taskinfo['add_time']}></p>
                    </a>
                </div>
                <a href="<{eval url('task/task_excel')}>?tid=<{$task_id}>" class="btn fr" style="background: #3f8bc0;">导出子任务</a>
                <div class="clear"></div>
            </div>
            <div class="mwenda-list mt10 bjf">
                <ul class="list-tab" data-cat="taskreclog">
                    <li class="on" data-type="0">
                        <a href="javascript:void(0);">所有子任务</a>
                    </li>
                    <li data-type="1">
                        <a href="javascript:void(0);">未验证</a>
                    </li>
                    <li data-type="2">
                        <a href="javascript:void(0);">已验证</a>
                    </li>
                    <li data-type="3">
                        <a href="javascript:void(0);">申诉</a>
                    </li>
                    <div class="clear"></div>
                </ul>
                <div class="task-list-content">
                    <div class="tl-list">
                        <ul class="list tl-title">
                            <li>任务名称</li>
                            <li class="flex8">任务相关信息</li>
                            <li class="money">任务金额</li>
                            <li class="status">状态</li>
                            <li></li>
                        </ul>
                        <div class="tl-content taskreclog-list-box" data-valid="<{$task_id}>">
                            <script>
                                $(function () {
                                    load_page_taskreclog();
                                });
                            </script>
                        </div>
                    </div>
                    <div class="pages fr" id="taskreclog_list_pagination"></div>
                </div>
            </div>
            <script>
                function check_task(tsid,status) {
                    $.ajax({
                        type: 'POST',
                        url: '/ajax/ajax_checktask.html',
                        data: {tsid: tsid, status: status},
                        dataType: "json",
                        success: function (result) {
                            var icon = result.reqStatus ? 1 : 2;
                            layer.msg(result.meg, {
                                icon: icon,
                                time: 2000
                            }, function () {
                                load_page_taskreclog();
                            })
                        }
                    });
                }
                function apply_finish(tid,sid) {
                    layer.confirm("确认结束该任务？", {
                        btn: ['确定', '取消'] //按钮
                    }, function () {
                        $.ajax({
                            type: 'POST',
                            url: '/task/end_subtask.html',
                            data: {tid: tid, sid: sid},
                            dataType: "json",
                            success: function (result) {
                                var icon = result.reqStatus ? 1 : 2;
                                layer.msg(result.msg, {
                                    icon: icon,
                                    time: 2000
                                }, function () {
                                    load_page_taskreclog();
                                })
                            }
                        });
                    }, function (indv) {
                        layer.close(indv);
                    });
                }
            </script>
            <{/if}>
            <{if $action == 'taskrecalllog'}>
            <div class="title bjf p10 mt10" style="line-height: 20px;">
                <div class="search-box fl" style="border: 1px solid #f07070;padding: 10px 20px;width: 695px;border-radius: 5px;">
                    <input type="text" name="" id="seach_task_value" value="" placeholder="输入任务编号" style="width: 100%;height: 24px;border: 0;line-height: 24px;color: #999;">
                </div>
                <a href="javascript:;" onclick="load_page_taskrecalllog();" class="btn fr" style="background: #3f8bc0;">搜索</a>
                <div class="clear"></div>
            </div>
            <div class="mwenda-list mt10 bjf">
                <ul class="list-tab" data-cat="taskrecalllog">
                    <li class="on" data-type="0">
                        <a href="javascript:void(0);">所有子任务</a>
                    </li>
                    <li data-type="1">
                        <a href="javascript:void(0);">未验证</a>
                    </li>
                    <li data-type="2">
                        <a href="javascript:void(0);">已验证</a>
                    </li>
                    <li data-type="3">
                        <a href="javascript:void(0);">申诉</a>
                    </li>
                    <div class="clear"></div>
                </ul>
                <div class="task-list-content">
                    <div class="tl-list">
                        <ul class="list tl-title">
                            <li>任务名称</li>
                            <li class="flex8">任务相关信息</li>
                            <li class="money">任务金额</li>
                            <li class="status">状态</li>
                            <li></li>
                        </ul>
                        <div class="tl-content taskrecalllog-list-box" data-valid="<{$task_id}>">
                            <script>
                                $(function () {
                                    load_page_taskrecalllog();
                                });
                            </script>
                        </div>
                    </div>
                    <div class="pages fr" id="taskrecalllog_list_pagination"></div>
                </div>
            </div>
            <script>
                function check_task(tsid,status) {
                    $.ajax({
                        type: 'POST',
                        url: '/ajax/ajax_checktask.html',
                        data: {tsid: tsid, status: status},
                        dataType: "json",
                        success: function (result) {
                            var icon = result.reqStatus ? 1 : 2;
                            layer.msg(result.meg, {
                                icon: icon,
                                time: 2000
                            }, function () {
                                load_page_taskrecalllog();
                            })
                        }
                    });
                }
                function apply_finish(tid,sid) {
                    layer.confirm("确认结束该任务？", {
                        btn: ['确定', '取消'] //按钮
                    }, function () {
                        $.ajax({
                            type: 'POST',
                            url: '/task/end_subtask.html',
                            data: {tid: tid, sid: sid},
                            dataType: "json",
                            success: function (result) {
                                var icon = result.reqStatus ? 1 : 2;
                                layer.msg(result.msg, {
                                    icon: icon,
                                    time: 2000
                                }, function () {
                                    load_page_taskrecalllog();
                                })
                            }
                        });
                    }, function (indx) {
                        layer.close(indx);
                    });
                }
            </script>
            <{/if}>
            <{if $action == 'taskrec'}>
            <div class="mwenda-list mt30 bjf">
                <div class="p20">
                    <ul class="list-tab" data-cat="taskrec">
                        <li class="on" data-type="0">
                            <a href="javascript:void(0);">所有任务</a>
                        </li>
                        <li data-type="1">
                            <a href="javascript:void(0);">未提交</a>
                        </li>
                        <li data-type="2">
                            <a href="javascript:void(0);">已提交</a>
                        </li>
                        <div class="clear"></div>
                    </ul>
                    <div class="taskrec-list-box">
                        <script>$(function () {
                            load_page_taskrec();
                        });</script>
                    </div>

                    <div class="clear"></div>
                </div>
                <script>
                    function apply_finish(tid,sid) {
                        layer.confirm("确认结束该任务？", {
                            btn: ['确定', '取消'] //按钮
                        }, function () {
                            $.ajax({
                                type: 'POST',
                                url: '/task/end_subtask.html',
                                data: {tid: tid, sid: sid},
                                dataType: "json",
                                success: function (result) {
                                    var icon = result.reqStatus ? 1 : 2;
                                    layer.msg(result.msg, {
                                        icon: icon,
                                        time: 2000
                                    }, function () {
                                        load_page_taskrec();
                                    })
                                }
                            });
                        }, function (indd) {
                            layer.close(indd);
                        });
                    }
                    function cancel_apply(tid) {
                        layer.confirm("确认取消该任务？", {
                            btn: ['确定', '取消'] //按钮
                        }, function () {
                            $.ajax({
                                type: 'POST',
                                url: '/task/ajax_cancel_apply.html',//发送请求
                                data: {tid: tid},
                                dataType: "json",
                                success: function (result) {
                                    var icon = result.reqStatus ? 1 : 2;
                                    layer.msg(result.msg, {
                                        icon: icon,
                                        time: 2000
                                    }, function () {
                                        load_page_taskrec();
                                    })
                                }
                            });
                        }, function (ind) {
                            layer.close(ind);
                        });
                    }
                </script>
                <div class="pages fr" id="taskrec_list_pagination">
                </div>
            </div>
            <{/if}>
            <{if $action == 'taskappeal' || $action == 'taskreappeal'}>
            <div class="mwenda-list mt30 bjf">
                <div class="p20">
                    <div class="taskappeal-list-box">
                        <input type="hidden" name="sid" id="tsidval" value="<{$sid}>">
                        <input type="hidden" name="scid" id="tcidval" value="<{$cid}>">
                        <{if $appeal_info['status'] > 0 }>
                            <p>（==<{$appeal_info['status_val']}>==）</p>
                        <{else}>
                            <{if $action == 'taskreappeal'}>
                            申诉回复:
                            <{/if}>
                            <{if $action == 'taskappeal'}>
                            申诉信息：
                            <{/if}>
                            <textarea name="content_word" id="content_word" rows="5" cols="50"
                                      style="border:1px solid #c0c0c0"></textarea>

                            <a href="javascript:void(0);" onclick="appeal_sub();"><span class="bj-red colfff"
                                                                                        style="border-radius:3px;padding: 4px;">提&nbsp;&nbsp;交</span></a>
                            <{if $action == 'taskreappeal'}>
                            <a href="javascript:void(0);" onclick="adopt_sub(2,1);"><span class="bj-red colfff"
                                                                                          style="border-radius:3px;padding: 4px;">确认通过</span></a>
                            <a href="javascript:void(0);" onclick="adopt_sub(2,2);"><span class="bj-red colfff"
                                                                                          style="border-radius:3px;padding: 4px;">拒绝申诉</span></a>
                            <{/if}>
                            <{if $action == 'taskappeal' && $comm_info}>
                            <a href="javascript:void(0);" onclick="adopt_sub(1);"><span class="bj-red colfff"
                                                                                        style="border-radius:3px;padding: 4px;">取消申诉</span></a>
                            <{/if}>
                        <{/if}>
                        <{if $action == 'taskappeal' && $comm_info && $appeal_info['status']==1}>
                        <a href="javascript:void(0);" onclick="adopt_sub(3);"><span class="bj-red colfff"
                                                                                    style="border-radius:3px;padding: 4px;">申请客服介入</span></a>
                        <{/if}>
                        <{if $comm_info}>
                        <{foreach from=$comm_info item=val}>
                        <div class="con mt20 pb10">
                            <div class="right-info fl">
                                <a><{$val['content_word']}></a>
                                <div class="info mt10">
                                    发布人：<{$val['username']}>&nbsp;&nbsp;&nbsp;&nbsp;
                                    发布时间：<{$val['add_time']}>&nbsp;&nbsp;&nbsp;&nbsp;

                                </div>
                            </div>
                            <div class="fr" style="">
                            </div>
                            <div class="clear"></div>
                        </div>
                        <{/foreach}>
                        <{/if}>
                    </div>
                    <div class="clear"></div>
                    <script>
                        function appeal_sub() {
                            var tsid = $("#tsidval").val();
                            var content_word = $("#content_word").val();
                            $.ajax({
                                type: 'POST',
                                url: '/ajax/ajax_appealsub.html',//发送请求
                                data: {tsid: tsid, content_word: content_word},
                                dataType: "json",
                                success: function (result) {
                                    var icon = result.reqStatus ? 1 : 2;
                                    layer.msg(result.meg, {
                                        icon: icon,
                                        time: 2000
                                    }, function () {
                                        location.reload();
                                    })
                                }
                            });

                        }
                        function adopt_sub(type, status) {
                            var tsid = $("#tsidval").val();
                            var tscid = $("#tcidval").val();
                            if (type == 1) {
                                layer.confirm("确认取消申诉吗？", {
                                    btn: ['确定', '取消'] //按钮
                                }, function () {
                                    $.ajax({
                                        type: 'POST',
                                        url: '/ajax/ajax_cancelappeal.html',//发送请求
                                        data: {tsid: tsid, tscid: tscid},
                                        dataType: "json",
                                        success: function (result) {
                                            var icon = result.reqStatus ? 1 : 2;
                                            layer.msg(result.meg, {
                                                icon: icon,
                                                time: 2000
                                            }, function () {
                                                location.href = "/account/taskrec.html";
                                            })
                                        }
                                    });
                                }, function (inde) {
                                    layer.close(inde);
                                });
                            }
                            if (type == 2) {

                                var confirm_val = "";
                                if (status == 1) {
                                    confirm_val = "确认通过该申诉吗？（通过则直接支付佣金）";
                                } else if (status == 2) {
                                    confirm_val = "确认拒绝该申诉吗？";
                                }


                                layer.confirm(confirm_val, {
                                    btn: ['确定', '取消'] //按钮
                                }, function () {
                                    $.ajax({
                                        type: 'POST',
                                        url: '/ajax/ajax_appeal_state.html',//发送请求
                                        data: {tsid: tsid, tscid: tscid, status: status},
                                        dataType: "json",
                                        success: function (result) {
                                            var icon = result.reqStatus ? 1 : 2;
                                            layer.msg(result.meg, {
                                                icon: icon,
                                                time: 2000
                                            }, function () {
                                                location.href = "/account/taskreclog.html?tid=<{$tid}>";
                                            })
                                        }
                                    });
                                }, function (ind) {
                                    layer.close(ind);
                                });

                            }
                            if (type == 3) {
                                $.ajax({
                                    type: 'POST',
                                    url: '/ajax/ajax_taskkefu.html',//发送请求
                                    data: {tscid: tscid},
                                    dataType: "json",
                                    success: function (result) {
                                        var icon = result.reqStatus ? 1 : 2;
                                        layer.msg(result.meg, {
                                            icon: icon,
                                            time: 2000
                                        }, function () {
                                            location.href = "/account/taskrec.html";
                                        })
                                    }
                                });
                            }
                        }
                    </script>
                </div>
            </div>
            <{/if}>
            <{if $action == 'taskreclogdetail'}>
            <div class="mwenda-list mt30 bjf">
                <div class="p20">
                    <div class="taskappeal-list-box">
                        <p class="title-big">任务领取人</p>
                        <div class="title-box">
                            <span><{$detail['username']}></span>
                        </div>
                        <p class="title-big">领取时间</p>
                        <div class="title-box">
                            <span><{$detail['add_time']}></span>
                        </div>
                        <p class="title-big">提交时间</p>
                        <div class="title-box">
                            <span><{$detail['receive_time']}></span>
                        </div>
                        <p class="title-big">审核时间</p>
                        <div class="title-box">
                            <span class="collike"><{$detail['status_text']}></span>
                            <span><{$detail['check_time']}></span>
                        </div>
                        <p class="title-big">提交信息</p>
                        <div class="title-box">
                            <{if $detail['name']}>
                            <span>真实姓名：</span>
                            <b><{$detail['name']}></b>
                            <{/if}>
                            <{if $detail['identity']}>
                            <span>身份证：</span>
                            <b><{$detail['identity']}></b>
                            <{/if}>
                            <{if $detail['phone']}>
                            <span>手机号码：</span>
                            <b><{$detail['phone']}></b>
                            <{/if}>
                            <{if $detail['img_list']}>
                            <span>截图：</span>
                            <ul class="ht_ul">
                                <{foreach from=$detail['img_list'] item=imgval}>
                                <li class="image-li" style="float: left;"><img src="<{$imgval}>" width="200"><input type="hidden" name="task_demoimglist[]" value="<{$imgval}>"/> </li>
                                <{/foreach}>
                                <div class="clear"></div>
                            </ul>
                            <{/if}>
                        </div>
                        <div class="post-btn mt20">
                            <input type="hidden" name="sid" value="<{$sid}>"/>
                            <{if $detail['status']==0}>
                            <a class="btn mt20" href="javascript:void(0);" onclick="checktask(<{eval encrypt_wenda_id($sid)}>)"><span class='bj-red colfff' style='border-radius:3px;padding: 4px;'>验&nbsp;&nbsp;证</span></a>
                            <{/if}>
                        </div>
                    </div>
                    <div id="checkdiv" style="display: none">
                        <form action="">
                            <div style="padding:20px;">
                                <div>
                                    是否通过：<input type="radio" name="substatus" checked value="1">通过
                                    <input type="radio" name="substatus" value="2">不通过
                                </div>
                                <div>
                                    意见：
                                    <textarea name="suggestion" id="suggestion" rows="5" cols="50"
                                              style="border:1px solid #c0c0c0"></textarea>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="clear"></div>
                    <script>
                        function checktask(tsid) {
                            $("#tsidval").val(tsid);
                            var index = layer.open({
                                type: 1,
                                title: false,
                                area: ['500px', '260px'],
                                shadeClose: true, //点击遮罩关闭
                                content: $("#checkdiv"),
                                btn: ['确定', '取消'],
                                yes: function () {
                                    var status = $('input:radio[name="substatus"]:checked').val();
                                    var suggestion = $("#suggestion").val();
                                    $.ajax({
                                        type: 'POST',
                                        url: '/ajax/ajax_checktask.html',//发送请求
                                        data: {tsid: tsid, status: status, suggestion: suggestion},
                                        dataType: "json",
                                        success: function (result) {
                                            var icon = result.reqStatus ? 1 : 2;
                                            layer.msg(result.meg, {
                                                icon: icon,
                                                time: 2000
                                            }, function () {
                                                layer.close(index);
                                                load_page_taskreclog();
                                                location.reload();
                                            })
                                        }
                                    });
                                }
                            });
                        }
                        $(".image-li").on('click',function () {
                           var img = $(this).children('img').attr('src');
                            layer.open({
                                type: 1,
                                title: "查看大图",
                                area: '800px',
                                maxmin: true,
                                skin: 'layui-layer-nobg', //没有背景色
                                shadeClose: true,
                                content: "<img src='"+img+"' width='100%'>",
                            });
                        });
                    </script>
                </div>
            </div>
            <{/if}>
        </div>
    </div>
    <div class="clear"></div>
</div>
</div>
<script>
    function timer(intDiff, indef) {
        window.setInterval(function () {
            var day = 0, hour = 0, minute = 0, second = 0;//时间默认值
            if (intDiff > 0) {
                day = Math.floor(intDiff / (60 * 60 * 24));
                hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
                minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
                second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
                if (minute <= 9) minute = '0' + minute;
                if (second <= 9) second = '0' + second;

                day > 0 ? $('#day_show_' + indef).html(day + "天") : $('#day_show_' + indef).html('');
                hour > 0 ? $('#hour_show_' + indef).html(hour + '小时') : $('#hour_show_' + indef).html('');
                $('#minute_show_' + indef).html(minute + '分');
                $('#second_show_' + indef).html(second + '秒');

                intDiff--;
            }

        }, 1000);
    }
</script>
<!--底部-->
<{include file="public/footer.html"}>
